import requests


class Interface06():
    @classmethod
    def upload_file(self):
        url = 'http://www.woniusb.com:8090/woniusales/goods/upload'
        # 构建请求参数
        # dataxls = {
        #     'batchname': 'GB20180406'
        # }
        headers = {
            'Cookie': 'JSESSIONID=0FFD1F3C8B8B956E2CAC667D6571AF7F'
        }
        files = {
            'batchname': (None, 'GB20180323'),
            'batchfile': open(r'D:\Python Project\InterfaceTest\day01\dataxls\销售出库单.xls', 'rb')}
        req = requests.post(url, files=files,headers=headers)
        print(req.status_code)
        print(req.text)


if __name__ == '__main__':
    Interface06.upload_file()
